home *** CD-ROM | disk | FTP | other *** search
- Path: news.infinet.com!bgardner
- From: bgardner@infinet.com (Brian W. Gardner)
- Newsgroups: comp.lang.c++
- Subject: [Q] on Garbage Collection in mixed C/C++
- Date: 2 Feb 1996 15:35:14 GMT
- Organization: InfiNet
- Message-ID: <4etavi$4im@news1.infinet.com>
- NNTP-Posting-Host: rigel.infinet.com
- X-Newsreader: TIN [version 1.2 PL2]
-
- I have a situation where I need to mix C functions with C++ in a system
- that creates objects (using the new operator) that need to be deleted
- in another function. This is a "script" based system, where user-defined
- scripts are executed which create certain objects. When a particular
- script is complete, all the objects need to be destroyed from memory
- (garbage collection). As a real time system that runs continuously, receiving
- requests from different hosts on a network, I do not have the luxury
- of just allowing things to go out of scope; the main() could execute
- for weeks, allocating new objects until the system crashes.
-
- What I need is a way to keep a list of all the objects that are instantiated
- so that when a given script has run, a function which is called (a psuedo-
- destructor) will clean up all the memory that has been allocated by that
- given script (the "scripts" I am referring to are an OO language that
- was developed by my company to simplify applications. The C++ work that
- is joined to it is a database access library).
-
- If anyone has any advice to offer, in terms of referrences or algorythms
- or patterns, or whatever, I would be MOST appreciative! I have been
- very gratified with the advice I have received by those in this group who
- take the time to help others get the job done. I consider it the highest
- form of professionalism to work towards improving the lot of the
- programming community at large. Kudos to you all!
-
- --
- Brian W. Gardner "Captain, I protest; I am not a
- 495 Park Blvd. merry man!" - Lt. Worf
- Worthington, OH 43085
- bgardner@infinet.com (home) bgardner@hublink.com (office)
-